
example = 1

playSound(loop=True, out='snd')

if example == 1:
    oscReceive(bus='tr', address='/trig', port=8000)
    freeze(input='snd', triggerbus='tr')

    def trig(state):
        if state:
            sendOscControl(2, '/trig')
        else:
            sendOscControl(0, '/trig')

    frame = beginGUI(size=(100,100))
    makeToggle(frame, pos=(20,20), function=trig)
    endGUI(frame)

if example == 2:
    lfo(bus='met', frequency=1, wavetype='sawtooth', offset=0.99)
    freeze(input='snd', triggerbus='met')

if example == 3:
    lfo(bus='met', frequency=2, wavetype='sawtooth', offset=0.99)
    freeze(input='snd', triggerbus='met', out='fr')
    smooth(input='fr', smoothamp=.001, smoothfreq=.1, amplitude=4, out='smooth')
    lowpass(input='smooth', cutoff=5000)

startCsound()
